package cn.yitun.chat.yitunchatbasesdk.config;

import cn.yitun.chat.yitunactiondispatch.extend.ResultHandler;
import cn.yitun.chat.yitunactiondispatch.registry.ActionMethodInterceptorRegistry;
import cn.yitun.chat.yitunactiondispatch.registry.MethodArgumentResolverRegistry;
import cn.yitun.chat.yitunactiondispatch.registry.ResultHandlerRegistry;
import cn.yitun.chat.yitunchatbasesdk.server.im.dispatcher.impl.HandlerActionMethodInterceptor;
import cn.yitun.chat.yitunchatbasesdk.server.im.dispatcher.impl.HandlerArgumentResolver;
import cn.yitun.chat.yitunchatbasesdk.server.im.dispatcher.impl.HandlerMethodArgumentResolver;
import cn.yitun.chat.yitunchatbasesdk.server.im.dispatcher.impl.HandlerResultHandler;

/**
 * Date 2019-01-17 21:59:57<br>
 * Description
 * @author yitun
 * @since 1.1
 */

public class HandlerActionConfigurer extends HandlerActionConfigurerAdapter {

	@Override
	public void addMethodArgumentResolver(MethodArgumentResolverRegistry registry) {
		registry.add(new HandlerMethodArgumentResolver());
		registry.add(new HandlerArgumentResolver());
	}

	@Override
	public void addResultHandler(ResultHandlerRegistry resultHandlerRegistry) {
		resultHandlerRegistry.add(resultHandler());
	}

	public ResultHandler resultHandler() {
		HandlerResultHandler bean = new HandlerResultHandler();
		return bean;
	}
	
	@Override
	public void addActionMethodInterceptor(ActionMethodInterceptorRegistry registry) {
		registry.add(new HandlerActionMethodInterceptor());
	}
}
